﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Data;
using System.Text;
using Hsinchu.Model;

namespace Hsinchu.BLL
{
    /*
     * 用户管理业务逻辑
     */
    public class AdminManager
    {
        DAL.DataProcess dllDataProcess = new Hsinchu.DAL.DataProcess();

        /// <summary>
        /// 添加后台用户
        /// </summary>
        /// <param name="admin">要添加的后台用户对象</param>
        /// <returns>受影响行数</returns>
        public int AddAdminUser(MAdmin admin)
        {
            string _spName = "Insert_Admin";
            object[] _value = new object[3];            
            _value[0] = admin.Name;
            _value[1] = admin.PassWord;
            _value[2] = admin.GroupId;
            return dllDataProcess.getAffectRows(_spName, _value);
        }


        /// <summary>
        /// 查询所有后台用户（排除已删除的）
        /// </summary>
        /// <returns>DataTable</returns>
        public DataTable GetMAdmin()
        {
            string _spName = "Select_Admin";
            return dllDataProcess.getDataTable(_spName);
        }
    }
}
